package com.ruoyi.communitys.service.impl;

import com.ruoyi.communitys.domain.CommunityContent;
import com.ruoyi.communitys.mapper.CommunityContentMapper;
import com.ruoyi.communitys.service.CommunityContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommunityContentServiceImpl implements CommunityContentService {
    @Autowired
    private CommunityContentMapper contentMapper;
    @Override
    public CommunityContent getContent(String id) {
        return contentMapper.findById(id).get();
    }

    @Override
    public void addContent(CommunityContent content) {
        contentMapper.save(content);
    }

    @Override
    public void updateContent(CommunityContent content) {
        contentMapper.save(content);
    }

    @Override
    public void deleteContent(String id) {
        contentMapper.deleteById(id);
    }

    @Override
    public List<CommunityContent> findContentAll() {
        return contentMapper.findAll();
    }
}
